package arithmetic.leecode_arthmetic;

/**
 * 问题：移动零
 * 方法：双指针
 * 链接地址：<a href="https://leetcode.cn/problems/move-zeroes/description/?envType=study-plan-v2&envId=top-100-liked">...</a>
 */
public class Solution283 {

    public void moveZeroes(int[] nums) {
        //定义0的计数器
        int count = 0;
        for(int i = 0;i<nums.length;i++){
            if(nums[i]!=0){
                nums[count++] = nums[i];
            }
        }
        for(int i = count;i<nums.length;i++){
            nums[i] = 0;
        }
    }

}
